<?php
    // $arr = array("x","y","z");
    // array_unshift($arr,1);
    // array_push($arr,4);

    // print_r($arr);

    // array_shift($arr);
    // array_pop($arr);
    // print_r($arr);


    // $arr = array("x","y","z");
    // array_splice($arr,1,1);
    // array_splice($arr,1,0,"hello");
    // array_splice($arr,1,1,"hello");
    // print_r($arr);


    // $arr = array("x","y","z","a","b","c","h","k");
    // $newList = array_slice($arr,2,4);
    // print_r($newList);

    // $arr = array("x","y","z");
    // $list = array_reverse($arr);
    // print_r($list)

    // $arr = array("x","y","z");
    // $str = join("",$arr);
    // $str = implode($arr,"");
    // echo $str;


    // $arr = array("x","y","z");
    // $res = in_array(1,$arr);
    // echo $res ;


    // $arr = [1,1,1,1,1,1,1,1,1,1];
    // print_r(array_unique($arr));




    // 数组排序

    // 数值数组
    $list = array(4,6,2,22,11);
    // sort($list); 
    // rsort($list);
    // print_r($list);

    //非纯数字排序
    $cars=array("Volvo","BMW","Toyota");
    // sort($cars);
    // rsort($cars);
    // print_r($cars);


    $list = array("Peter"=>"35","Ben"=>"27","Joe"=>"43");

    // ksort($list);
    // krsort($list);
    // asort($list);
    arsort($list);
    print_r($list);
?>